home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '90 / Source Code ƒ.sea / Source Code ƒ / MPW C ƒ / Vinnie's MPW Hacks / ps.c < prev    next >
MacBinary  |  1990-06-15  |  2.0 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
10% dexvert Jesper Olsen Module (music/jesperOlsen) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file TTComp archive data, binary, 1K dictionary default (weak)
99% file MacBinary II, Fri Jun 15 13:08:29 1990, modified Fri Jun 15 13:08:29 1990, creator 'MPS ', type ASCII, 1439 bytes "ps.c" , at 0x61f 382 bytes resource default (weak)
98% file data default
49% TrID Macintosh plain text (MacBinary) default
33% TrID TTComp archive compressed (bin-1K) default (weak)
16% TrID MacBinary 2 default (weak)
0% TrID Sybase iAnywhere database files default (weak)
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 04 70 73 2e 63 00 00 | 00 00 00 00 00 00 00 00 |..ps.c..|........|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 00 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 05 9f 00 | 00 01 7e a2 9e c6 8d a2 |........|..~.....|
|00000060| 9e c6 8d 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 c6 da 00 00 |........|........|
|00000080| 09 09 50 72 4f 70 65 6e | 50 61 67 65 28 70 70 6f |..PrOpen|Page(ppo|
|00000090| 72 74 2c 20 6e 69 6c 29 | 3b 0d 09 09 09 69 66 20 |rt, nil)|;....if |
|000000a0| 28 50 72 45 72 72 6f 72 | 28 29 3d 3d 6e 6f 45 72 |(PrError|()==noEr|
|000000b0| 72 29 0d 09 09 09 09 43 | 6f 70 79 42 69 74 73 20 |r).....C|opyBits |
|000000c0| 28 26 6f 66 66 53 63 72 | 65 65 6e 2c 20 26 28 70 |(&offScr|een, &(p|
|000000d0| 70 6f 72 74 2d 3e 67 50 | 6f 72 74 2e 70 6f 72 74 |port->gP|ort.port|
|000000e0| 42 69 74 73 29 2c 0d 09 | 09 09 09 09 26 28 6f 66 |Bits),..|....&(of|
|000000f0| 66 53 63 72 65 65 6e 2e | 62 6f 75 6e 64 73 29 2c |fScreen.|bounds),|
|00000100| 20 26 28 6f 66 66 53 63 | 72 65 65 6e 2e 62 6f 75 | &(offSc|reen.bou|
|00000110| 6e 64 73 29 2c 0d 09 09 | 09 09 09 09 73 72 63 43 |nds),...|....srcC|
|00000120| 6f 70 79 2c 20 6e 69 6c | 29 3b 0d 09 09 09 50 72 |opy, nil|);....Pr|
|00000130| 43 6c 6f 73 65 50 61 67 | 65 28 70 70 6f 72 74 29 |ClosePag|e(pport)|
|00000140| 3b 0d 09 09 7d 0d 09 09 | 50 72 43 6c 6f 73 65 44 |;...}...|PrCloseD|
|00000150| 6f 63 28 70 70 6f 72 74 | 29 3b 0d 09 7d 0d 09 69 |oc(pport|);..}..i|
|00000160| 66 20 28 20 28 28 2a 2a | 68 50 72 69 6e 74 29 2e |f ( ((**|hPrint).|
|00000170| 70 72 4a 6f 62 2e 62 4a | 44 6f 63 4c 6f 6f 70 20 |prJob.bJ|DocLoop |
|00000180| 3d 3d 20 62 53 70 6f 6f | 6c 4c 6f 6f 70 29 0d 09 |== bSpoo|lLoop)..|
|00000190| 09 09 20 26 26 20 28 50 | 72 45 72 72 6f 72 28 29 |.. && (P|rError()|
|000001a0| 20 3d 3d 20 6e 6f 45 72 | 72 29 20 29 0d 09 09 50 | == noEr|r) )...P|
|000001b0| 72 50 69 63 46 69 6c 65 | 20 28 68 50 72 69 6e 74 |rPicFile| (hPrint|
|000001c0| 2c 20 6e 69 6c 2c 20 6e | 69 6c 2c 20 6e 69 6c 2c |, nil, n|il, nil,|
|000001d0| 20 26 50 72 53 74 61 74 | 75 73 29 3b 0d 09 09 0d | &PrStat|us);....|
|000001e0| 20 20 20 20 53 65 74 46 | 72 61 63 74 45 6e 61 62 | SetF|ractEnab|
|000001f0| 6c 65 28 66 61 6c 73 65 | 29 3b 0d 20 20 20 20 53 |le(false|);. S|
|00000200| 65 74 46 53 63 61 6c 65 | 44 69 73 61 62 6c 65 28 |etFScale|Disable(|
|00000210| 66 61 6c 73 65 29 3b 0d | 0d 09 50 72 43 6c 6f 73 |false);.|..PrClos|
|00000220| 65 28 29 3b 0d 0d 09 53 | 65 74 50 6f 72 74 20 28 |e();...S|etPort (|
|00000230| 6f 6c 64 50 6f 72 74 29 | 3b 0d 7d 0d 0d 76 6f 69 |oldPort)|;.}..voi|
|00000240| 64 20 6d 61 69 6e 4c 6f | 6f 70 28 29 0d 7b 0d 09 |d mainLo|op().{..|
|00000250| 42 6f 6f 6c 65 61 6e 09 | 09 09 64 6f 6e 65 20 3d |Boolean.|..done =|
|00000260| 20 66 61 6c 73 65 3b 0d | 09 45 76 65 6e 74 52 65 | false;.|.EventRe|
|00000270| 63 6f 72 64 09 09 74 68 | 65 45 76 65 6e 74 3b 0d |cord..th|eEvent;.|
|00000280| 09 57 69 6e 64 6f 77 50 | 74 72 09 09 77 68 69 63 |.WindowP|tr..whic|
|00000290| 68 57 69 6e 64 6f 77 3b | 0d 09 73 68 6f 72 74 09 |hWindow;|..short.|
|000002a0| 09 09 70 61 72 74 3b 0d | 09 0d 09 77 68 69 6c 65 |..part;.|...while|
|000002b0| 20 28 20 21 64 6f 6e 65 | 20 29 0d 09 7b 0d 09 09 | ( !done| )..{...|
|000002c0| 69 66 20 28 20 47 65 74 | 4e 65 78 74 45 76 65 6e |if ( Get|NextEven|
|000002d0| 74 28 65 76 65 72 79 45 | 76 65 6e 74 2c 20 26 74 |t(everyE|vent, &t|
|000002e0| 68 65 45 76 65 6e 74 29 | 20 29 0d 09 09 7b 0d 09 |heEvent)| )...{..|
|000002f0| 09 09 73 77 69 74 63 68 | 20 28 20 74 68 65 45 76 |..switch| ( theEv|
|00000300| 65 6e 74 2e 77 68 61 74 | 20 29 0d 09 09 09 7b 0d |ent.what| )....{.|
|00000310| 09 09 09 09 63 61 73 65 | 20 75 70 64 61 74 65 45 |....case| updateE|
|00000320| 76 74 3a 0d 09 09 09 09 | 09 64 6f 55 70 64 61 74 |vt:.....|.doUpdat|
|00000330| 65 28 64 69 73 70 6c 61 | 79 29 3b 0d 09 09 09 09 |e(displa|y);.....|
|00000340| 09 62 72 65 61 6b 3b 0d | 0d 09 09 09 09 63 61 73 |.break;.|.....cas|
|00000350| 65 20 6d 6f 75 73 65 44 | 6f 77 6e 3a 0d 09 09 09 |e mouseD|own:....|
|00000360| 09 09 70 61 72 74 20 3d | 20 46 69 6e 64 57 69 6e |..part =| FindWin|
|00000370| 64 6f 77 28 74 68 65 45 | 76 65 6e 74 2e 77 68 65 |dow(theE|vent.whe|
|00000380| 72 65 2c 20 26 77 68 69 | 63 68 57 69 6e 64 6f 77 |re, &whi|chWindow|
|00000390| 29 3b 0d 09 09 09 09 09 | 69 66 20 28 20 28 77 68 |);......|if ( (wh|
|000003a0| 69 63 68 57 69 6e 64 6f | 77 20 3d 3d 20 64 69 73 |ichWindo|w == dis|
|000003b0| 70 6c 61 79 29 20 26 26 | 20 28 70 61 72 74 20 3d |play) &&| (part =|
|000003c0| 3d 20 69 6e 47 6f 41 77 | 61 79 29 20 29 0d 09 09 |= inGoAw|ay) )...|
|000003d0| 09 09 09 09 64 6f 6e 65 | 20 3d 20 74 72 75 65 3b |....done| = true;|
|000003e0| 0d 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 0d 09 09 |......br|eak;....|
|000003f0| 09 09 63 61 73 65 20 6b | 65 79 44 6f 77 6e 3a 0d |..case k|eyDown:.|
|00000400| 09 09 09 09 09 69 66 20 | 28 20 27 70 27 20 3d 3d |.....if |( 'p' ==|
|00000410| 20 28 74 68 65 45 76 65 | 6e 74 2e 6d 65 73 73 61 | (theEve|nt.messa|
|00000420| 67 65 20 26 20 63 68 61 | 72 43 6f 64 65 4d 61 73 |ge & cha|rCodeMas|
|00000430| 6b 29 20 29 0d 09 09 09 | 09 09 09 70 72 69 6e 74 |k) )....|...print|
|00000440| 54 69 6c 65 28 29 3b 0d | 09 09 09 09 09 62 72 65 |Tile();.|.....bre|
|00000450| 61 6b 3b 0d 09 09 09 7d | 0d 09 09 7d 0d 09 7d 0d |ak;....}|...}..}.|
|00000460| 7d 0d 0d 0d 76 6f 69 64 | 20 63 6c 65 61 6e 55 70 |}...void| cleanUp|
|00000470| 28 29 0d 7b 0d 09 44 69 | 73 70 6f 73 65 57 69 6e |().{..Di|sposeWin|
|00000480| 64 6f 77 28 64 69 73 70 | 6c 61 79 29 3b 0d 09 44 |dow(disp|lay);..D|
|00000490| 69 73 70 6f 73 50 74 72 | 28 28 50 74 72 29 20 6f |isposPtr|((Ptr) o|
|000004a0| 66 66 53 63 72 65 65 6e | 2e 62 61 73 65 41 64 64 |ffScreen|.baseAdd|
|000004b0| 72 29 3b 0d 7d 0d 0d 0d | 69 6e 74 20 6d 61 69 6e |r);.}...|int main|
|000004c0| 20 28 0d 09 69 6e 74 20 | 20 61 72 67 63 2c 09 09 | (..int | argc,..|
|000004d0| 09 2f 2a 20 6e 75 6d 62 | 65 72 20 6f 66 20 61 72 |./* numb|er of ar|
|000004e0| 67 75 6d 65 6e 74 73 20 | 2a 2f 0d 09 63 68 61 72 |guments |*/..char|
|000004f0| 20 2a 61 72 67 76 5b 5d | 2c 09 09 2f 2a 20 70 6f | *argv[]|,../* po|
|00000500| 69 6e 74 65 72 20 74 6f | 20 61 72 72 61 79 20 6f |inter to| array o|
|00000510| 66 20 61 72 67 75 6d 65 | 6e 74 20 73 74 72 69 6e |f argume|nt strin|
|00000520| 67 73 20 2a 2f 0d 09 63 | 68 61 72 20 2a 65 6e 76 |gs */..c|har *env|
|00000530| 70 5b 5d 29 09 09 2f 2a | 20 70 6f 69 6e 74 65 72 |p[])../*| pointer|
|00000540| 20 74 6f 20 61 72 72 61 | 79 20 6f 66 20 76 61 72 | to arra|y of var|
|00000550| 69 61 62 6c 65 20 64 65 | 66 69 6e 69 74 69 6f 6e |iable de|finition|
|00000560| 73 20 2a 2f 0d 7b 0d 09 | 23 70 72 61 67 6d 61 20 |s */.{..|#pragma |
|00000570| 75 6e 75 73 65 64 20 28 | 65 6e 76 70 29 0d 0d 09 |unused (|envp)...|
|00000580| 49 6e 69 74 47 72 61 66 | 28 28 50 74 72 29 20 26 |InitGraf|((Ptr) &|
|00000590| 71 64 2e 74 68 65 50 6f | 72 74 29 3b 0d 09 53 65 |qd.thePo|rt);..Se|
|000005a0| 74 46 53 63 61 6c 65 44 | 69 73 61 62 6c 65 28 74 |tFScaleD|isable(t|
|000005b0| 72 75 65 29 3b 0d 20 20 | 20 20 49 6e 69 74 43 75 |rue);. | InitCu|
|000005c0| 72 73 6f 72 28 29 3b 0d | 09 0d 09 69 66 20 28 20 |rsor();.|...if ( |
|000005d0| 61 72 67 63 20 21 3d 20 | 32 20 29 0d 09 7b 0d 09 |argc != |2 )..{..|
|000005e0| 09 70 72 69 6e 74 66 20 | 28 22 23 23 23 20 57 72 |.printf |("### Wr|
|000005f0| 6f 6e 67 20 4e 75 6d 62 | 65 72 20 6f 66 20 50 61 |ong Numb|er of Pa|
|00000600| 72 61 6d 65 74 65 72 73 | 20 23 23 23 5c 6e 22 29 |rameters| ###\n")|
|00000610| 3b 0d 09 09 72 65 74 75 | 72 6e 20 32 3b 0d 09 00 |;...retu|rn 2;...|
|00000620| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000630| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000640| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000660| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000670| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000680| 4f 70 65 6e 28 29 3b 0d | 0d 20 20 20 20 53 65 74 |Open();.|. Set|
|00000690| 46 72 61 63 74 45 6e 61 | 62 6c 65 28 74 72 75 65 |FractEna|ble(true|
|000006a0| 29 3b 0d 20 20 20 20 53 | 65 74 46 53 63 61 6c 65 |);. S|etFScale|
|000006b0| 44 69 73 61 62 6c 65 28 | 74 72 75 65 29 3b 0d 0d |Disable(|true);..|
|000006c0| 09 68 50 72 69 6e 74 20 | 3d 20 28 54 48 50 72 69 |.hPrint |= (THPri|
|000006d0| 6e 74 29 20 4e 65 77 48 | 61 6e 64 6c 65 28 73 69 |nt) NewH|andle(si|
|000006e0| 7a 65 6f 66 28 54 50 72 | 69 6e 74 29 29 3b 0d 09 |zeof(TPr|int));..|
|000006f0| 69 66 20 28 52 65 73 45 | 72 72 6f 72 28 29 29 0d |if (ResE|rror()).|
|00000700| 09 7b 0d 09 09 70 72 69 | 6e 74 66 20 28 22 50 72 |.{...pri|ntf ("Pr|
|00000710| 69 6e 74 69 6e 67 20 45 | 72 72 6f 72 20 25 64 5c |inting E|rror %d\|
|00000720| 6e 22 2c 20 52 65 73 45 | 72 72 6f 72 28 29 29 3b |n", ResE|rror());|
|00000730| 0d 09 09 53 79 73 42 65 | 65 70 28 31 29 3b 0d 09 |...SysBe|ep(1);..|
|00000740| 09 50 72 43 6c 6f 73 65 | 28 29 3b 0d 09 09 72 65 |.PrClose|();...re|
|00000750| 74 75 72 6e 3b 0d 09 7d | 0d 09 0d 09 64 72 6f 70 |turn;..}|....drop|
|00000760| 20 3d 20 50 72 56 61 6c | 69 64 61 74 65 28 68 50 | = PrVal|idate(hP|
|00000770| 72 69 6e 74 29 3b 0d 09 | 6e 6f 74 43 61 6e 63 65 |rint);..|notCance|
|00000780| 6c 6c 65 64 20 3d 20 50 | 72 4a 6f 62 44 69 61 6c |lled = P|rJobDial|
|00000790| 6f 67 20 28 68 50 72 69 | 6e 74 29 3b 0d 09 09 0d |og (hPri|nt);....|
|000007a0| 09 69 66 20 28 6e 6f 74 | 43 61 6e 63 65 6c 6c 65 |.if (not|Cancelle|
|000007b0| 64 29 0d 09 7b 0d 09 09 | 70 70 6f 72 74 20 3d 20 |d)..{...|pport = |
|000007c0| 50 72 4f 70 65 6e 44 6f | 63 28 68 50 72 69 6e 74 |PrOpenDo|c(hPrint|
|000007d0| 2c 20 6e 69 6c 2c 20 6e | 69 6c 29 3b 0d 09 09 69 |, nil, n|il);...i|
|000007e0| 66 20 28 20 50 72 45 72 | 72 6f 72 28 29 20 3d 3d |f ( PrEr|ror() ==|
|000007f0| 20 6e 6f 45 72 72 20 29 | 0d 09 09 7b 0d 09 00 00 | noErr )|...{....|
+--------+-------------------------+-------------------------+--------+--------+